function [max_value,min_value] = get_extrema(A0_coef,b_fun,k)
if k == 1
    basis_value_right = [b_fun{1}(1),b_fun{2}(1)];
    basis_value_left = [b_fun{1}(-1),b_fun{2}(-1)];
    basis_value = [basis_value_right;basis_value_left];
    value = basis_value*A0_coef;
elseif k==2
    basis_value_right = [b_fun{1}(1),b_fun{2}(1),b_fun{3}(1)];
    basis_value_left = [b_fun{1}(-1),b_fun{2}(-1),b_fun{3}(-1)];
    extrema = (-A0_coef(2))/(3*A0_coef(3));
    if extrema >= -1 && extrema <= 1
        basis_value_extrema = [b_fun{1}(extrema),b_fun{2}(extrema),b_fun{3}(extrema)];
        basis_value = [basis_value_right;basis_value_left;basis_value_extrema];
        value = basis_value*A0_coef;
    else
        basis_value = [basis_value_right;basis_value_left];
        value = basis_value*A0_coef;
    end
end
max_value = max(value);
min_value = min(value);
end